package com.big.merchan.controller.admin;

import com.big.common.result.Result;
import com.big.merchan.receiver.MerchandiseReceiver;
import com.big.merchan.service.MerchandiseOffersService;
import com.big.model.model.merchandise.MerchandiseOffers;
import com.big.model.vo.merchandise.admin.MerchanSaveVo;
import com.big.model.vo.photo.PhotoVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/merchan/offers")
@Slf4j
public class MerchandiseOffersController {



    @Autowired
    MerchandiseOffersService merchandiseOffersService;


    @Autowired
    MerchandiseReceiver merchandiseReceiver;


    @ApiOperation(value = "优惠方式列表")
    @GetMapping("/infos/{mId}")
    public Result offersInfos(@PathVariable("mId") String mId){
        List<MerchandiseOffers> merchandiseOffers = merchandiseOffersService.merchandiseOffersInfos(mId);
       return Result.ok(merchandiseOffers);
    }

    @ApiOperation(value = "添加商品")
    @PostMapping("/save")
    public Result offersInfos(@RequestBody MerchanSaveVo m){
        merchandiseReceiver.SaveAssemble(m);
        return Result.ok();
    }




}
